import {Component, OnInit, ViewEncapsulation} from '@angular/core';
import {Params} from '@angular/router';
import {Router} from '@angular/router';
import {ActivatedRoute} from '@angular/router';
import {GoodsTicketService} from "@goods/goods-ticket/goods-ticket.service";


@Component({
  selector: 'seed-goods-ticket-info',
  templateUrl: './goods-ticket-info.component.html',
  styleUrls: ['./goods-ticket-info.component.scss'],
  encapsulation: ViewEncapsulation.None

})
export class GoodsTicketInfoComponent implements OnInit {
public orderNumber: string;
public ticketerInfo: any;
  constructor(
    public route: ActivatedRoute,
    public router: Router,
    private goodsTicketService: GoodsTicketService) {
    this.route.queryParams.subscribe((params: Params) => {
      this.orderNumber = params['orderNumber'];
      this.getTicketerInfo();
    });
  }

  /**
   * @description 获取取票人信息
   * @author ouyqx-691
   * @param orderNumber 订单编号
   */
  getTicketerInfo() {
    const  orderNumber = this.orderNumber;
    this.goodsTicketService.getTicketerInfo(orderNumber).subscribe(res => {
      if (res.result === '0' && res.data) {
        this.ticketerInfo = res.data;
      }
    });
  }

  ngOnInit() {
  }

}
